package com.zpark;

import javax.servlet.ServletContext;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

/**
 * ServletContext03取出ServletContext02存放的数据
 */
@WebServlet("/c3.do")
public class ServletContext03 extends HttpServlet {
	@Override
	protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
		// 获取ServletContext对象
		ServletContext context = req.getServletContext();
		// 取出上下应用文对象当中存储的数据
		String dc = (String) context.getAttribute("dc");

		System.out.println(dc);
	}
}
